namespace OneWorks.Utils.FluentData
{
    public class SelectBuilderData : BuilderData
    {
        public int PagingCurrentPage { get; set; }
        public int PagingItemsPerPage { get; set; }
        public string Having { get; set; }
        public string GroupBy { get; set; }
        public string OrderBy { get; set; }
        public string From { get; set; }
        public string Select { get; set; }
        public string WhereSql { get; set; }

        public SelectBuilderData(IDbCommand command, string objectName) : base(command, objectName)
        {
            this.Having = "";
            this.GroupBy = "";
            this.OrderBy = "";
            this.From = "";
            this.Select = "";
            this.WhereSql = "";
            this.PagingCurrentPage = 1;
            this.PagingItemsPerPage = 0;
        }

        internal int GetFromItems()
        {
            return (this.GetToItems() - this.PagingItemsPerPage + 1);
        }

        internal int GetToItems()
        {
            return (this.PagingCurrentPage*this.PagingItemsPerPage);
        }
    }
}